<%@include file="/_checkSession.jsp"%>
<%@ page language="java" import="java.util.*, Container.Item, Container.Message, java.text.SimpleDateFormat" pageEncoding="ISO-8859-1"%>

<%
	Item item = (Item)request.getAttribute("item");

	
%> 


<!DOCTYPE html>
<html xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/">
<head>
	<style type="text/css">
		body #Body .btn, body #Body c-std {
		filter:none;
		-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#0079bc',endColorstr='#00509d')";
		}
	</style>
	<title> White Samsung Galaxy S 3 Smartphone Unlocked Most Network Worldwide 8806085094536 | eBay</title>
	<!-- <link href="http://gh.ebaystatic.com/header/css/all.min?combo=11&amp;siteid=2&amp;rvr=93&amp;factor=REFRESHER&amp;h=22247" type="text/css" rel="stylesheet"> -->
	<link href="css/5ssdwbylqq1bhajbymf2j5bwo.css" type="text/css" rel="stylesheet">
	<style type="text/css">
		body ul#bc a {
		                white-space:nowrap;
		}
		body .sz1280 .vi-VR-brumblnkLst{
		                max-width:500px;
		}
		body .sz1152 .vi-VR-brumblnkLst{
		                max-width:450px;
		}
		.sz940 .vi-VR-brumblnkLst{
		                max-width:300px;
		}
		body .sz1280 .vi-bc-topM .vi-VR-brumb-hasNoPrdlnks{
		                max-width:800px;
		}
		body .sz1152 .vi-bc-topM .vi-VR-brumb-hasNoPrdlnks{
		                max-width:750px;
		}
		.sz940 .vi-bc-topM .vi-VR-brumb-hasNoPrdlnks{
		                max-width:550px;
		}
	</style>
	<script type="text/javascript">
    	function validate()
    	{ 
    		var co = document.getElementsByName("co")[0];
    		var bo = document.getElementsByName("bo")[0];
    		var price = document.getElementsByName("price")[0];

    		var cri = /^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,2})?$/;
    		
    		if(!price.value.match(cri)){
    			alert("please input valid number with less than 2 decimal point and the price should not start with 0 !");
    			return false;
    		}
    		
    		
    		if(price.value*100<=co.value)
    		{
				alert("your bid price should be greater than current offer");
				return false;
    		}
    		
			if (bo.value>0 && price.value*100>=bo.value) {
				alert("your bid price should be less than buyout price");
                return false;

            } 
    		
    		
    		return true;
    	}
    	function validateComment(){
    		var num = document.getElementsByName("comment")[0].value.length;
    		if(num<5){
    			alert("not enough length for comments");
    			return false;
    		}
    		return true;
    	}
    
    
    </script>
	
	
	
</head>
<body><br><br><br><br>
 

	<div id="Body" class="sz940 sz1280" itemscope="itemscope" itemtype="http://schema.org/Product">
 
		<div id="CenterPanelDF"><br> 

		<div id="CenterPanel" class="ebaylocale_en_CA ">
			<!-- Placement 100011 && 100012 -->
<div class="hero-unit">
		<div id="CenterPanelInternal">
			<div id="PicturePanel" class="pp-c">
				<div class="pp-ic pp-ic500">
					<div class=" img img500">
						<table class="img img500">
							<tbody><tr><td class="img img500">
								<div id="picturePanelIcon"><br><img id="freeShip" src="http://p.ebaystatic.com/aw/pics/s.gif" alt="FREE shipping" title="FREE shipping" class="picIcon vi-freeShip" style="left:455px;display:none;"></div>
									<a href="javascript:;" style="display: block; cursor: default; text-decoration: none;">
								<div id="mainImgHldr" style="width: 500px; cursor: pointer;">
								<%if(item.getImg()!=null){ %>
									<img id="icImg" class="img img500" itemprop="image" src="${pageContext.request.contextPath}/img/<%=item.getImg() %>" style="" clk="0" alt="">
								<%} else{%>
									<img id="icImg" class="img img500" itemprop="image" src="${pageContext.request.contextPath}/img/null.gif" style="" clk="0" alt="">
								<%} %>
								</div>						
							</td></tr></tbody>
						</table>
					</div>
				</div>
			</div>
			<div><h1 class="it-ttl" itemprop="name" id="itemTitle"><%=item.getName() %></h1></div>
			<div class="it-rlBr  it-rlBr500 "></div>
			<div id="RightSummaryPanel" class="rsp-c"><br>
				<div style="clear: both;"></div><br>
				<div id="rtm_html_1527" style="width: 300px; height: 265px; overflow: hidden; display: block;"><br></div>
			</div> 	
			<div id="LeftSummaryPanel" class="lsp-c lsp-cRight  lsp-cL500 ">
				<div class="is " style="overflow:hidden;">
					
						<div class="nonActPanel">
							<div class="u-cb spcr"></div>						
							<div>
								<div class="u-flL lable">Description:</div>
								<div class="u-flL condText"><%=item.getDescription() %></div>
							</div>
							<div class="u-cb spcr"></div>
							<div>
								<div class="u-flL lable">Seller name:</div>
								<div class="u-flL condText"><%=item.getSellername() %></div>
							</div>
							<div class="u-cb spcr"></div>
							<div>
								<div class="u-flL lable">End time:</div>
								<%SimpleDateFormat format = new SimpleDateFormat("MM dd yyyy, HH:mm:ss"); %>
								<div class="u-flL condText"><%=format.format(item.getEnd()) %></div>
							</div>
							<div class="u-cb spcr"></div>
						</div>
						<div class="actPanel">			
							<div class="u-cb spcr"></div>
							<%if(item.getBo()!=0){ %>
								<form action="RequestProcess" method="post" enctype="multipart/form-data">						
									<div class="u-cb">
										<div class="u-flL lable binLable" id="prcIsum-lbl">Price:</div>
										<div id="vi-mskumap-none" style="" class="u-flL w29 vi-price" itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer">						
											<span class="notranslate" id="prcIsum" itemprop="price" style=""><b>$  </b><%=item.getBo()/100.0 %></span>
											<input type="hidden" name="uid" value=<%= session.getAttribute("uid") %>>
	            							<input type="hidden" name="sid" value=<%= session.getAttribute("sid") %>>
	           								<input type="hidden" name="type" value="buyout">
	           								<input type="hidden" name="iid" value=<%= item.getIid() %>>
										</div>
										<div class="u-flL">
											<%if(item.getSeller()==(Integer)(session.getAttribute("uid"))){ %>
												<button type="submit" class="btn btn-primary" disabled>Buy it Now</button>
											<%}else{%>
												<button type="submit" class="btn btn-primary">Buy it Now</button>
											<%}%>	
										</div>
									</div>	
								</form>
							<%} %>
															
							<div class="u-cb spcr"></div>

							<form onsubmit="return validate()" action="RequestProcess" method="post" enctype="multipart/form-data">
								<div class="u-cb">
									<div class="u-flL lable binLable" id="prcIsum-lbl">Price:</div>
									<div id="vi-mskumap-none" style="" class="u-flL w29 vi-price" itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer">						
										<span class="notranslate" id="prcIsum" itemprop="price" style="">
										<%if(item.getSeller()==(Integer)(session.getAttribute("uid"))){ %>
											<input type="text" name="price" placeholder="Current Offer $ <%=item.getCo()/100.0 %>" disabled>
										<%} else{%>	
											<input type="text" name="price" placeholder="Current Offer $ <%=item.getCo()/100.0 %>">
										<%}%>
										</span>
										<input type="hidden" name="uid" value=<%= session.getAttribute("uid") %>>
            							<input type="hidden" name="sid" value=<%= session.getAttribute("sid") %>>
           								<input type="hidden" name="type" value="bid">
           								<input type="hidden" name="iid" value=<%= item.getIid() %>>
          								<input type="hidden" name="co" value=<%=item.getCo() %>>
										<input type="hidden" name="bo" value=<%=item.getBo() %>>
										<span itemprop="availability" content="http://schema.org/OnlineOnly"></span>
										<span itemprop="priceCurrency" content="CAD"></span>
									</div>
									<div class="u-flL">
									
									
									
									
									<%if(item.getSeller()==(Integer)(session.getAttribute("uid"))){ %>
										<button type="submit" class="btn btn-primary"  disabled>Bid</button>
									<%} else{%>
										<button type="submit" class="btn btn-primary">Bid</button>
									<%}%>
									
									
									
									
									</div>
								</div>
								<div class="u-cb spcr"></div>
							</form>
							
							
							
							
							
							
						</div>
					
				</div>
			</div>
		</div>
	
	
	
	
		<div id="BottomPanelDF">
			<div id="BottomPanel">
				<div id="rwid" ><br> 
					<div class="trr c3" id="v4-0"> 
						<span> 
							
<%
if(!item.getComment().isEmpty()){
%>
							<div class="trrtopln"><div class="trrtl"><h2 class="mg f17">Comments</h2></div></div> 
<%
	ArrayList<Message> msgList = (ArrayList<Message>)item.getComment();
	Iterator<Message> it = msgList.iterator();
	while(it.hasNext()){ 
		Message msg = it.next();

%>
							<div itemprop="reviews" itemscope="itemscope" itemtype="http://schema.org/Review" class="sgrv spln"> 
								<div class="trrln spcln"> 
								<%SimpleDateFormat format2 = new SimpleDateFormat("MM dd yyyy, HH:mm:ss"); %>
									<div class="trrrt trrcttm">Review created: <%=format.format(msg.getDate()) %><span itemprop="datePublished" content="2012-08-01"></span></div>
								</div> 
								<div class="trrln spcln"> 
									<div> by: <div class="mbg"><span class="mbg-nw"><%=msg.getUsername() %></span> <span class="mbg-l"></span><span class="mbg-l"></span></div><span itemprop="author" content="roygutgon75"></span></div> 
								</div> 
								<div itemprop="reviewBody" class="sgrvctt spcln"><%=msg.getComment() %><div class="sp">&nbsp;</div></div> 
							</div> 
							
<%	} 
}else{%>
						<div class="trrtopln"><div class=" trrtl"><h2 class="mg f17">No Comments</h2></div></div>
<%} %>
											
						</span>
					</div>
				
				</div><br><br>
					<form class="navbar-form" action="RequestProcess" method="post" enctype="multipart/form-data" onsubmit="return validateComment()">
			           	<textarea rows="5" name="comment" cols="100"></textarea><br>
			            <input type="hidden" name="uid" value=<%= session.getAttribute("uid") %>>
			            <input type="hidden" name="sid" value=<%= session.getAttribute("sid") %>>
			           	<input type="hidden" name="type" value="comment">
			           	<input type="hidden" name="iid" value=<%= item.getIid() %>>
			            <button type="submit" class="btn btn-primary">Comment</button>
			        </form>					
			</div>  
		</div>
		
		

		
		
	</div>				
		</div>
	</div>

<link href="${pageContext.request.contextPath}/css/wcnxxfthlq5mrgk4bbp00ounh.css" type="text/css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/z0vyqyhdp2zgzogiufqbtyeeo.css" type="text/css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/cpazcnmt2u0pfpyqbvqspvnq0.css" type="text/css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/2vfaazjvna3bzgvnyfyzw5b4a.css" type="text/css" rel="stylesheet">
</div>

</body>
</html>